package com.ryan.security.wiremock;

import com.github.tomakehurst.wiremock.WireMockServer;
import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder;
import com.github.tomakehurst.wiremock.client.WireMock;

/**
 * Created by kaimin on 1/1/2019.
 * time : 11:25
 */
public class MockServer {
    //连部署的wiremockserver,以及告诉程序怎么操作
    public static void main(String[] args) {
        WireMock.configureFor(8062);//指定连接信息
        WireMock.removeAllMappings();//每次执行时，把之前旧的配置清空


        //指定连接和返回相关信息
        WireMock.stubFor(WireMock.get(WireMock.urlEqualTo("/order/1")).
                willReturn(ResponseDefinitionBuilder.responseDefinition().withBody("\"username\":\"aaa\",\"password\":\"null\"").withStatus(200)));
    }
}
